package com.hrhx.sender;

import java.util.List;

import org.apache.log4j.Logger;

import com.hrhx.sender.dingding.DingDingSender;
import com.hrhx.sender.email.EmailSender;
import com.hrhx.sender.sms.SmsSender;

/**
 * 信息发送工厂，可以产出<br/>
 * 邮件发送、<br/>
 * 多邮件请求发送接口发送、<br/>
 * SMS、<br/>
 * DingDingTalk发送<br/>
 * 等工厂产品<br/>
 * @author duhongming
 *
 */
public class MessageSenderFactory{
	
	private static Logger log = Logger.getLogger(MessageSenderFactory.class);
	
	/**
	 * 邮件附件发送处理方法<br/>
	 * 需要主动调用send()进行发送
	 * @param configEmailBean
	 * @param to
	 * @param subject
	 * @param content
	 * @param filenameList
	 * @return
	 */
	public static MessageSenderInterface produceMail(
			ConfigEmailBean	configEmailBean,
			String to,
			String copyto,
			String subject,
			String content,
			List<String> filenameList
	) {
		log.info("MessageSenderFactory工厂模式启用：produceMail开始执行！");
		EmailSender emailSender= new EmailSender();
		emailSender.setConfigEmailBean(configEmailBean);
		emailSender.setTo(to);
		emailSender.setCopyto(copyto);
		emailSender.setSubject(subject);
		emailSender.setContent(content);
		emailSender.setFilenameList(filenameList);
		return emailSender;							
	}

	public static MessageSenderInterface produceSms() {
		return new SmsSender();
	}
	
	public static MessageSenderInterface produceDingDing() {
		return new DingDingSender();
	}
	
}
